<% @page_title = search_posts_title -%>

<h1>
<% if params[:q].blank? -%>
  <%= @page_title %>
<% else -%>
  <%= 'Searching for'[] %> '<%= h params[:q] %>'
<% end -%>
</h1>
<p class="subtitle">
  <%= feed_icon_tag @page_title, search_path(true) %>
  <%= '{count} post(s) found'[(count=@posts.total_entries)==1 ? :post_count_found : :posts_count_found, number_with_delimiter(count)] %>
</p>

<%= pagination @posts %>

<table border="0" cellspacing="0" cellpadding="0" class="posts wide">
<% for post in @posts do %>
<% unless post == @posts.first %>
<tr class="spacer">
  <td colspan="2">&nbsp;</td>
</tr>
<% end %>
<tr class="post hentry" id="<%= dom_id post %>">
  <td class="author vcard">
    <div class="date">
      <abbr class="updated" title="<%= post.created_at.xmlschema %>">
      <%= jstime(post.created_at) %>
      </abbr>
    </div>

    <%= avatar_for @users[post.user_id] %>
    <span class="fn"><%= link_to truncate(h(@users[post.user_id].display_name), 15), user_path(post.user) %></span>
    <span class="posts"><%= '{count} posts'[(count=@users[post.user_id].posts.size)==1 ? :post_count : :posts_count, number_with_delimiter(count)] %></span>
  </td>
  <td class="body entry-content">
    <p class="topic">
      <%= "Topic"[:topic_title] %>: <%= link_to h(post.forum_name), forum_path(post.forum) %> / 
      <%= link_to h(post.topic_title), forum_topic_path(post.forum, post.topic) %>
    </p>
    
    <%= post.body_html %>
  </td>
</tr>

<% end %>
</table>

<%= next_page @posts %>
<%= pagination @posts %>